package com.mty.cc.service.impl;


import com.mty.cc.mapper.NoticeMapper;
import com.mty.cc.po.Notice;
import com.mty.cc.service.NoticeService;
import com.mty.cc.util.uuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {

    @Autowired(required=false)
    private NoticeMapper noticeMapper;

    /*
     * @description: 添加
     * @author: mty
     */
    @Override
    public void add(Notice notice) {
        notice.setId(uuid.getRandomIdByUUID());
        noticeMapper.insert(notice);
    }

    /*
     * @description: 按照主键更新
     * @author: mty
     */
    @Override
    public void update(Notice notice) {
        noticeMapper.update(notice);
    }

    /*
     * @description: 按照ID删除
     * @author: mty
     */
    @Override
    public void deleteById(String id) {
        noticeMapper.deleteById(id);
    }

    /*
     * @description: 查询全部
     * @author: mty
     */
    @Override
    public List<Notice> queryByAll() {
        return noticeMapper.queryByAll();
    }

    /*
     * @description: 根据ID查询
     * @author: mty
     */
    @Override
    public Notice queryById(String id) {
        return noticeMapper.queryById(id);
    }
}

